package org.baiyun.kaka.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.baiyun.kaka.dao.IUserDao;
import org.baiyun.kaka.entity.User;
import org.baiyun.kaka.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service("userService")//告诉系统，我这是一个Service，叫userService
@Transactional
public class UserServiceImpl implements IUserService {

	@Autowired//自动注入
	private IUserDao iUserDao;
	
	
	@Override
	public List<User> findAll() {
		return iUserDao.findAll();//调用dao成的findALL方法
	}

	@Override
	public User get(int id) {
		return iUserDao.get(id);//直接调用dao的get方法完成数据查询
	}

	@Override
	public Integer save(User user) {
		return iUserDao.save(user);
	}

	@Override
	public boolean delete(int id) {
		return iUserDao.delete(id);
	}

	@Override
	public boolean update(User user) {
		return iUserDao.update(user);
	}

	@Override
	public List<User> findUserByName(String name) {

		return iUserDao.findUserByName(name);
	}

}
